{extend name="base" /}
{block name="body"}

    <!--tab标签-->
    <div class="layui-tab-brief">
    
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form class="layui-form form-container" data-url="{:es_url('usergradeAdd')}"  localtion-url="{:es_url('usergradeList')}" >
                    <div class="layui-form-item">
                        <label class="layui-form-label">名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="name"  required lay-verify="required" placeholder="请输入等级名称" class="layui-input">
                        </div>
                    </div>
                      <div class="layui-form-item">
                        <label class="layui-form-label">{$scoretypelist['expoint1']}</label>
                        <div class="layui-input-inline">
                            <input type="number" name="score"  required lay-verify="required" placeholder="积分为整数" class="layui-input">
                        </div>
                    </div>
    <div class="layui-form-item">
                        <label class="layui-form-label">权限组</label>
                        <div class="layui-input-inline">
                    <input type="checkbox" name="quanx[]" value="1" title="发帖" checked>
                         <input type="checkbox" name="quanx[]" value="2"  title="回帖"> 
                        </div>
                    </div>
                 <div class="layui-form-item">
                        <label class="layui-form-label">等级图标</label>
                        <div class="layui-input-block">
                         <div id='upload_show_div1' style="width:120px;display: inline;">
                    <img style='max-width:100px; margin-right: 20px;' src="{$info['cover_id']|default='0'|get_picture_url}" />
                </div>
               
                <input type="hidden" name="cover_id" id='cover_id' value="{$info['cover_id']|default='0'}"/>
                       <div id="coverimg"></div>   
                          <span class="layui-btn layui-btn-primary layui-btn-small clearid" data-name="cover_id" data-divname="upload_show_div1" >清除图片</span>
                      
   </div>
                    </div>
      

<link rel="stylesheet" href="__PUBLIC__/js/webuploader/webuploader.css" />
<script src="__PUBLIC__/js/webuploader/webuploader.nolog.min.js"></script>
<script>
var upload_param1 = WebUploader.create({

    // 选完文件后，是否自动上传。
    auto: true,

    // swf文件路径
    swf: "WEB_URL"+'/addon/imginput/static/dist/Uploader.swf',
    chunked: false,
    chunkSize: 512 * 1024,
    // 文件接收服务端。
    server: "{:es_url('File/pictureUpload')}",

    // 选择文件的按钮。可选。
    // 内部根据当前运行是创建，可能是input元素，也可能是flash.
    pick: {
            id: '#coverimg',
            label: '点击选择文件'
        },
        fileNumLimit: 1,
        disableGlobalDnd: true,
    // 只允许选择图片文件。
    accept: {
       
    }
});

upload_param1.on('uploadSuccess',function( file, response) {

	 var show_img_url = response.headpath;

	  
	    $( '#upload_show_div1').html("<img style='max-width:100px; margin-right: 20px;' src='"+show_img_url+"' />");
	    $('#cover_id').val(response.id);

});



</script>
                    <div class="btable-paged" >
				<div class="layui-main">
                    <div class="formbtngroup">
<button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="formadd">添加</button>
<a href="javascript:;"  class="layui-btn layui-btn-primary layui-btn-sm closebtn">返回</a>
</div>
</div>
        </div>
                </form>
            </div>
        </div>
    </div>

{/block}
